home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / obsolete / f_test.pro < prev    next >
Text File  |  1997-07-08  |  1KB  |  58 lines

  1. ; $Id: f_test.pro,v 1.2 1997/01/15 04:02:19 ali Exp $
  2. ;
  3. ;  Copyright (c) 1991-1997, Research Systems Inc.  All rights
  4. ;  reserved. Unauthorized reproduction prohibited.
  5.  
  6.  
  7. function f_test, a,DFN,DFD
  8. ;+
  9. ; NAME:
  10. ;     F_TEST
  11. ;
  12. ; PURPOSE:
  13. ;    F_TEST returns the cutoff value v such that:
  14. ;
  15. ;        Probability(X > v) = a
  16. ;
  17. ;    where X is a random variable from the F distribution with DFN and DFD
  18. ;    numerator and denominator degrees of freedom.
  19. ;
  20. ; CATEGORY:
  21. ;    Statistics.
  22. ;
  23. ; CALLING SEQUENCE:
  24. ;     Result = F_TEST(A, DFN, DFD)
  25. ;
  26. ; INPUT:
  27. ;    A:    probability
  28. ;
  29. ;    DFN:    numerator degrees of freedom
  30. ;
  31. ;    DFD:    denominator degrees of freedom
  32. ;
  33. ; OUTPUT: 
  34. ;    If A is between 0 and 1, then the cutoff value is returned. 
  35. ;    Otherwise, -1 is returned to indicate an error.
  36. ;-
  37. if (a gt 1 or a lt 0) then return,-1  
  38.  
  39. case 1 of
  40.  DFD EQ 1: UP=300.0 
  41.  DFD EQ 2: UP =100.0 
  42.  DFD GT 2 and  DFD LE 5: UP=30.0
  43.  DFD GT 5 and DFD LE 14: UP = 20.0
  44.  ELSE: UP = 12.0
  45. ENDCASE
  46.  
  47. Below=0
  48.  
  49.  while f_test1(UP,DFN,DFD) LT 1- a DO BEGIN
  50.       Below = UP
  51.       UP = 2*UP
  52.  ENDWHILE
  53.  
  54.  
  55. return, pd_bisection([1-a,DFN,DFD],'f_test1',Up,Below)
  56. end
  57.  
  58.